import java.util.*;

public class text {
    public static void main(String[] args) {
        //斗地主
        LinkedHashMap<Integer,String> poker=new LinkedHashMap<>();
        String[] colors= {"♠", "♣", "♦", "♥"};
        String[] number={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
        poker.put(1,"大joker");
        poker.put(2,"小joker");
        int n=3;
        for (String number1:number){
            for (String color1:colors){
                poker.put(n,color1+number1);
                n++;
            }
        }
        System.out.println(poker);
        //洗牌
        List<Integer> pokerList = new ArrayList<>(poker.keySet());
        Collections.shuffle(pokerList);
        LinkedHashMap<Integer,String> poker1=new LinkedHashMap<>();
        for (int i = 0; i < pokerList.size() ; i++) {
            int key= pokerList.get(i);
            String value= poker.get(key);
            poker1.put(key,value);
        }
        System.out.println(poker1);

        //摸牌
        Player p1=new Player();p1.setName("老王");
        Player p2=new Player();p2.setName("老钟");
        Player p3=new Player();p3.setName("老黄");
        LinkedHashMap<Integer,String> dipai=new LinkedHashMap<>();
        int i=0;
        for(int key : poker1.keySet()) {
            String value = poker1.get(key);

                if (i >= 51) {
                    dipai.put(key, value);
                } else if (i % 3 == 0) {
                    p1.getPoker().put(key,value);
                } else if (i % 3 == 1) {
                    p2.getPoker().put(key,value);
                } else if (i % 3 == 2) {
                    p3.getPoker().put(key,value);
                }
            i++;
        }
        Map p11=new TreeMap<>(p1.getPoker());
        Map p12=new TreeMap<>(p2.getPoker());
        Map p13=new TreeMap<>(p3.getPoker());
        System.out.println(p1.getName()+"的牌"+p11);
        System.out.println(p2.getName()+"的牌"+p12);
        System.out.println(p3.getName()+"的牌"+p13);
        System.out.println("底牌为："+dipai);
    }
}
